package utils;

import org.testng.Assert;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * Created with IntelliJ IDEA.
 * User: u
 * Date: 7/20/14
 * Time: 6:14 PM
 * To change this template use File | Settings | File Templates.
 */
public class PropertyLoader {  private static String workingDir = System.getProperty("user.dir");

    private static final String PROPERTY_FILE = workingDir + "\\target\\classes\\application.properties";

    public static String loadProperty(String name) {

        Properties props = new Properties();
        try {
            props.load(new FileInputStream(PROPERTY_FILE));
        } catch (IOException e) {
            Assert.fail(Log4Test.info(name));
        }
        String value = "";
        if (name != null) {
            value = props.getProperty(name);
        }
        return value;
    }
}
